using SalesPages.DomainModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class PromotionItemMap : EntityTypeConfiguration<PromotionItem>
    {
        public PromotionItemMap()
        {
            // Primary Key
            this.HasKey(t => t.PromoItemId);

            // Properties
            this.Property(t => t.Style)
                .HasMaxLength(50);

            this.Property(t => t.SchoolName)
                .HasMaxLength(50);

            this.Property(t => t.SiteVersion)
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("PromotionItems");
            this.Property(t => t.PromoItemId).HasColumnName("PromoItemId");
            this.Property(t => t.PromoId).HasColumnName("PromoId");
            this.Property(t => t.Style).HasColumnName("Style");
            this.Property(t => t.SchoolName).HasColumnName("SchoolName");
            this.Property(t => t.PromoValue).HasColumnName("PromoValue");
            this.Property(t => t.SiteVersion).HasColumnName("SiteVersion");
        }
    }
}
